import sys
from datetime import datetime as dt

def log_error_obj (error_obj):
    print("[{dt}] {0.__class__.__name__}: {0}".format(error_obj, dt=dt.now()), file=sys.stderr)

def fget (name):
    try:
        with open(name) as f:
            return f.read()
    except IOError as er:
        log_error_obj(er)
        return ""

def fset (name, value):
    try:
        with open(name, "w") as f:
            f.write(value)
        return True
    except IOError as er:
        log_error_obj(er)
        return False
